<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <!--点击切换标签-->
        <input type="button" value="标签One" @click="a='templatelabelone'" />
        <input type="button" value="标签Two" @click="a='templatelabeltwo'" />
        <!--组件-->
        <component :is="a"></component>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                message: 'runoob',
                fruits: ['pear', 'apple', 'banana', 'orange', 'watermelon'],
                a:'templatelabelone'
            },
            components:{
                'templatelabelone':{template:'<h1>这个是标签One</h1>'},
                'templatelabeltwo':{template:'<h1>这个是标签Two</h1>'},
            }
        })
    </script>

</body>

</html>